//
//  MePushTableViewCell.m
//  BGM
//
//  Created by liuqin on 2018/11/29.
//  Copyright © 2018年 com.alirtc.demo. All rights reserved.
//

#import "MePushTableViewCell.h"


#import "Common.h"

@interface MePushTableViewCell()


@end


@implementation MePushTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self != nil) {
        
        self.backgroundColor = [UIColor clearColor];
        //时间
        self.timeLabel = [[UILabel alloc]initWithFrame:CGRectMake(40, 0, SCREENW, 30)];
        self.timeLabel.text = @"2018-10-20";
        self.timeLabel.font = [UIFont systemFontOfSize:12];
        self.timeLabel.textColor = bgmsmallColor;
        [self addSubview:self.timeLabel];
        
        
        
        UIImageView *iconImage = [[UIImageView alloc]initWithFrame:CGRectMake(20, 7, 15, 15)];
        [iconImage setImage:[UIImage imageNamed:@"pushCircle"]];
        [self addSubview:iconImage];
        
        UILabel *line = [[UILabel alloc]initWithFrame:CGRectMake(27, iconImage.frame.origin.y+iconImage.frame.size.height, 0.3, (SCREENH-70)/4-iconImage.frame.origin.y-iconImage.frame.size.height)];
        line.backgroundColor = [UIColor grayColor];
        line.alpha = 0.3;
        [self addSubview:line];
        
        UIView *bgView = [[UIView alloc]initWithFrame:CGRectMake(45, 30, SCREENW-60, 120-30)];
        bgView.backgroundColor = [UIColor whiteColor];
        bgView.layer.cornerRadius = 6;
        bgView.layer.masksToBounds = YES;
        [self addSubview:bgView];
        
        
        //头像
        self.headImage = [[UIButton alloc]initWithFrame:CGRectMake(15, (bgView.frame.size.height-bgView.frame.size.height/2)/2, bgView.frame.size.height/2, bgView.frame.size.height/2)];
        [bgView addSubview:self.headImage];
        
        
        self.messageLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.headImage.frame.origin.x+self.headImage.frame.size.width+15, 10, bgView.frame.size.width-self.headImage.frame.size.width-30, bgView.frame.size.height/2)];

        self.messageLabel.textColor = bgmmainColor;
         self.messageLabel.font = [UIFont systemFontOfSize:17];
        [bgView addSubview:self.messageLabel];
//
        self.commentBtn = [[CommonBtn alloc]initWithFrame:CGRectMake(bgView.frame.size.width-120, bgView.frame.size.height-40, 40, 30)];
        [self.commentBtn setImage:[UIImage imageNamed:@"pinglun"] forState:UIControlStateNormal];
        [bgView addSubview:self.commentBtn];

        self.forwardBtn = [[CommonBtn alloc]initWithFrame:CGRectMake(bgView.frame.size.width-80, bgView.frame.size.height-40, 40, 30)];
        [self.forwardBtn setImage:[UIImage imageNamed:@"zhuanfa"] forState:UIControlStateNormal];
        [bgView addSubview:self.forwardBtn];
        
        
        self.acceptBtn = [[CommonBtn alloc]initWithFrame:CGRectMake(bgView.frame.size.width-40, bgView.frame.size.height-40, 40, 30)];
        [self.acceptBtn setImage:[UIImage imageNamed:@"accept"] forState:UIControlStateNormal];
        [bgView addSubview:self.acceptBtn];

      
        self.label2 = [[UILabel alloc]initWithFrame:CGRectMake(self.messageLabel.frame.origin.x, self.acceptBtn.frame.origin.y+5, 40, 20)];
        self.label2.textColor = bgmgrayColor;
        self.label2.backgroundColor = bgmColor(250, 241, 194);
        self.label2.font = [UIFont systemFontOfSize:12];
        self.label2.layer.cornerRadius = 9;
        self.label2.layer.masksToBounds = YES;
        self.label2.textAlignment = NSTextAlignmentCenter;
        self.label2.layer.borderColor = bgmColor(250, 203, 11).CGColor;
        self.label2.layer.borderWidth = 1;
        [bgView addSubview:self.label2];
        

        self.label1 = [[UILabel alloc]initWithFrame:CGRectMake(self.label2.frame.origin.x+self.label2.frame.size.width+5, self.acceptBtn.frame.origin.y+5, 70, 20)];
        self.label1.text = @"帮转红包";
        self.label1.textColor = bgmgrayColor;
        self.label1.backgroundColor = bgmColor(250, 241, 194);
        self.label1.font = [UIFont systemFontOfSize:12];
        self.label1.layer.cornerRadius = 9;
        self.label1.layer.masksToBounds = YES;
        self.label1.textAlignment = NSTextAlignmentCenter;
        self.label1.layer.borderColor = bgmColor(250, 203, 11).CGColor;
        self.label1.layer.borderWidth = 1;
        [bgView addSubview:self.label1];
        
        
    }
    return self;
}



- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
